<script>
import { onMounted, reactive, toRefs } from 'vue'
import { getStorelist } from '../api/commonApi'
export default {
  name: 'AboutView',
  setup() {
    const state = reactive({
      list: []
    })
    // 调取api获取数据
    const getNewsList = () => {
      const params = {
        page: 1,
        pageSize: 5
      }
      getStorelist(params).then((res) => {
        console.log(res)
        const { data } = res
        state.list = data.data
      })
    }
    onMounted(getNewsList)
    // ...toRefs()将state里面得对象解构
    return {
      ...toRefs(state)
    }
  }
}
</script>

<template>
  <div class="about">
    <h1>This is an about page</h1>
  </div>
</template>

<style>
@media (min-width: 1024px) {
  .about {
    min-height: 100vh;
    display: flex;
    align-items: center;
  }
}
</style>
